import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AdmFileBorrowVO, AdmFileBorrowForm, AdmFileBorrowQuery } from '@/api/general/administration/file/borrow/types';

/**
 * 查询档案借阅列表
 * @param query
 * @returns {*}
 */

export const listAdmFileBorrow = (query?: AdmFileBorrowQuery): AxiosPromise<AdmFileBorrowVO[]> => {
  return request({
    url: '/system/admFileBorrow/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询档案借阅详细
 * @param id
 */
export const getAdmFileBorrow = (id: string | number): AxiosPromise<AdmFileBorrowVO> => {
  return request({
    url: '/system/admFileBorrow/' + id,
    method: 'get'
  });
};

/**
 * 新增档案借阅
 * @param data
 */
export const addAdmFileBorrow = (data: AdmFileBorrowForm) => {
  return request({
    url: '/system/admFileBorrow',
    method: 'post',
    data: data
  });
};

/**
 * 修改档案借阅
 * @param data
 */
export const updateAdmFileBorrow = (data: AdmFileBorrowForm) => {
  return request({
    url: '/system/admFileBorrow',
    method: 'put',
    data: data
  });
};

/**
 * 删除档案借阅
 * @param id
 */
export const delAdmFileBorrow = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/admFileBorrow/' + id,
    method: 'delete'
  });
};
